package cn.lingnan.mapper;

import cn.lingnan.pojo.dto.UserLoginDTO;
import cn.lingnan.pojo.entity.Admin;
import cn.lingnan.pojo.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface LoginMapper {
    @Select("select * from property.user_info where phone_number = #{phoneNumber} and password = #{password}")
    User userLogin(UserLoginDTO userLoginDTO);

    @Insert("insert into property.user_info(user_id, user_name, phone_number, password, email, create_time, update_time, status) values" +
            "( #{userId}, #{userName}, #{phoneNumber}, #{password}, #{email}, #{createTime}, #{updateTime}, #{status})")
    void userRegister(User user);

    @Select("select * from property.admin_info where account = #{account} and password = #{md5PWD}")
    Admin AdminLogin(String account, String md5PWD);
}
